package edu.zut.cs.javaee.manager.teacher.domain;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.List;

import edu.zut.cs.javaee.manager.base.domain.BaseTreeEntity;

@Entity
@Table(name="T_SUBJECT")
@NamedQueries({ @NamedQuery(name = "Subject.getRoot", query = "select m from Subject m ") })
public class Subject extends BaseTreeEntity<Subject,Long> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6402627300038711410L;
	@Column
	String name;
	
	@Column
	String specialty;
	
	@OneToMany(mappedBy = "subject",cascade = CascadeType.REMOVE,fetch = FetchType.EAGER)
	List<Teacher>teachers;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSpeciatly() {
		return specialty;
	}

	public void setSpeciatly(String specialty) {
		this.specialty = specialty;
	}

}
